package com.dnapipeline.modelManage.service;

import com.dnapipeline.modelManage.entity.ProfileModel;
import com.dnapipeline.modelManage.repository.ProfileRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ProfileService {

    @Autowired
    private ProfileRepository profileRepository;

    // 根据profileModelKey获取characteristicNodeId和value
    public ProfileModel getProfileDetails(String profileModelKey) {
        return profileRepository.findByProfileModelKey(profileModelKey);
    }

    // 更新value
    public ProfileModel updateProfileValue(String profileModelKey, String newValue) {
        ProfileModel profile = profileRepository.findByProfileModelKey(profileModelKey);
        if (profile != null) {
            profile.setValue(newValue);
            return profileRepository.save(profile);
        }
        return null;
    }
} 